﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Manager.Master" Inherits="System.Web.Mvc.ViewPage<CommentViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="product">
        <div class="product_img">
            <a href="<%= Url.Action("Preview", "Product", new {ProductId = Model.Product.ProductId}) %>"
                target="_blank">
                <img src="<%= string.Format("{0}/{1}/s_{2}", Model.ImageRoot, Model.Product.ProductId, Model.Product.ImageName) %>"
                    alt="<%= Model.Product.ProductName %>" class="img1" title="<%= Model.Product.ProductName %>" /></a>
        </div>
        <div class="product_memo">
            <dl>
                <dt>
                    <%=Model.Product.ProductName %></dt>
                <dd>
                    上线时间：<%=Model.Product.SaleDateTime %>
                </dd>
                <dd>
                    激活状态：<%=Html.CheckBox("isActive", Model.Product.IsActive, new { disabled="disabled" })%></dd>
                <dd>
                    商品编号：<%=Model.Product.ProductNo %></dd>
                <dd>
                    零售价：<%=Model.Product.Price %></dd>
                <dd>
                    折扣率：<%=Model.Product.DisCount.ToString("0.00") %></dd>
                <dd>
                    实际销售价：<%=(Model.Product.Price * (decimal)Model.Product.DisCount).ToString("0.00") %></dd>
                <dd>
                    库存数：<%=Model.Product.StockCount %></dd>
                <dd>
                    点击数：<%=Model.Product.ClickCount %></dd>
                <dd>
                    评论数：[已审核
                    <%=Model.Product.ReplyCount %>
                    未审核
                    <%=Model.Product.UnAuditCommentNum %>]</dd>
            </dl>
        </div>
    </div>
    <% using (Html.BeginForm("CommentBatch", "Comment", new {
           productPage = ViewData["ProductPage"],
           productId = Model.Product.ProductId,
           commentPage = Model.PageNumber
       }, FormMethod.Post)) {%>
    <div class="btnBar">
        <div class="btnBarLeft ">
            <div class="divPager2">
                <%= Html.Pager(Model.Pager) %>
            </div>
        </div>
        <%=Html.UrlButton("返回商品列表", Url.Action("CommentProduct", "Comment", new { 
            audit = ViewData["Audit"], 
            productPage = ViewData["ProductPage"]
        }), "urlBtn") %>
        <input type="button" value="审核多个" accesskey="a" />
        <input type="button" value="删除多个" accesskey="d" />
    </div>
    <table class="gv">
        <tr class="title">
            <td>
            </td>
            <td>
                评论内容
            </td>
            <td class="textCenter">
                其它信息
            </td>
            <td>
            </td>
        </tr>
        <% 
            int rowIndex = 1;
            foreach (CommentEntity ce in Model.CommentList) { 
        %>
        <tr class="<%=Html.AlternateRowClass(rowIndex++, "alter") %>">
            <td class="width20 textCenter">
                回复[<%=ce.ReplyNum %>]
            </td>
            <td>
                <%=ce.Content %>
            </td>
            <td class="width100 textCenter">
                <input type="checkbox" name="cbKeyComment" id="cbKeyComment<%=ce.CommentId%>" value="<%=ce.CommentId%>" /><label
                    for="cbKeyComment<%=ce.CommentId %>"><%=ce.IsAudit ? "<span class=\"colorBlue\">已审核</span>" : "<span class=\"colorRed\">未审核</span>"%></label>
                <br />
                <%=ce.AddDate %>
                <br />
                <%=string.IsNullOrEmpty(ce.UserName) ? ce.NickName : ce.UserName %>
                <br />
                评分
                <%=ce.GradeValue %>
            </td>
            <td class="width50 textCenter">
                <%=Html.UrlButton("审核", Url.Action("CommentAudit", new {
                    audit = ViewData["Audit"], 
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    commentPage = Model.PageNumber,
                    ids = ce.CommentId
                }), "urlBtn")%>
                <%=Html.UrlButton("编辑", Url.Action("CommentEdit", new {
                    audit = ViewData["Audit"], 
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    commentPage = Model.PageNumber,
                    commentId = ce.CommentId
                }), "urlBtn")%>
                <%=Html.UrlButton("删除", Url.Action("CommentDelete", new {
                    audit = ViewData["Audit"],           
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    ids = ce.CommentId,
                }), "urlBtn", "确定要删除吗?")%>
            </td>
        </tr>
        <% int rowIndex1 = 1;
           foreach (CommentEntity rce in Model.ReCommentList.Where(c => { return c.ReCommentId == ce.CommentId; })) { %>
        <tr class="<%=Html.AlternateRowClass(rowIndex-1, "alter") %>">
            <td class="floor">
                <%=rowIndex1++ %>楼
            </td>
            <td>
                <%=rce.Content %>
            </td>
            <td class="width100 textCenter">
                <input type="checkbox" name="cbKeyComment" value="<%=rce.CommentId%>" id="cbKeyComment<%=rce.CommentId%>" /><label
                    for="cbKeyComment<%=rce.CommentId %>"><%=rce.IsAudit ? "<span class=\"colorBlue\">已审核</span>" : "<span class=\"colorRed\">未审核</span>"%></label>
                <br />
                <%=rce.AddDate %>
                <br />
                <%=string.IsNullOrEmpty(rce.UserName) ? rce.NickName : rce.UserName %>
            </td>
            <td class="width50 textCenter">
                <%=Html.UrlButton("审核", Url.Action("CommentAudit", new {
                    audit = ViewData["Audit"], 
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    commentPage = Model.PageNumber,
                    ids = rce.CommentId
                }), "urlBtn")%>
                <%=Html.UrlButton("编辑", Url.Action("CommentEdit", new {
                    audit = ViewData["Audit"], 
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    commentPage = Model.PageNumber,
                    commentId = rce.CommentId
                }), "urlBtn")%>
                <%=Html.UrlButton("删除", Url.Action("CommentDelete", new {
                    audit = ViewData["Audit"], 
                    productPage = ViewData["ProductPage"],
                    productId = Model.Product.ProductId,
                    ids = rce.CommentId,
                }), "urlBtn", "确定要删除吗?")%>
            </td>
        </tr>
        <% }
            } %>
    </table>
    <div class="btnBar">
        <div class="btnBarLeft">
            <div class="divPager2">
                <%= Html.Pager(Model.Pager) %>
            </div>
        </div>
        <%=Html.UrlButton("返回商品列表", Url.Action("CommentProduct", "Comment", new { 
            audit = ViewData["Audit"], 
            productPage = ViewData["ProductPage"]
        }), "urlBtn") %>
        <input type="button" value="审核多个" accesskey="a" />
        <input type="button" value="删除多个" accesskey="d" />
    </div>
    <%} %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CssLink" runat="server">
    <link href="<%=Url.Content("~/Css/Manager/ProductList.css") %>" rel="stylesheet"
        type="text/css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="JsLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .product
        {
            overflow: auto;
            padding: 10px;
            border: 1px solid #ccc;
        }
        .floor
        {
            font-family: Arial;
            font-size: 18px;
            font-style: italic;
            font-weight: bold;
        }
    </style>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $(":button[accesskey!='']").click(function () {
                var ak = $(this).attr("accesskey");
                if (ak == undefined) { return; }
                var urld = '<%=Url.Action("CommentDelete", new { audit = ViewData["Audit"], productPage = ViewData["ProductPage"], productId = Model.Product.ProductId, commentPage = Model.PageNumber, ids = "-ids-" }) %>';
                var urla = '<%=Url.Action("CommentAudit", new { audit = ViewData["Audit"], productPage = ViewData["ProductPage"], productId = Model.Product.ProductId, commentPage = Model.PageNumber, ids = "-ids-" }) %>';
                var cb = $(":checkbox[name='cbKeyComment'][checked='true']");
                var msg = "确定要" + (ak == "d" ? "删除" : "审核") + "选择的多条记录吗?";
                var val = "", url = ak == "d" ? urld : urla;
                if (cb.length < 1) { alert("未选择记录!"); return; }
                else { cb.each(function () { val += "," + $(this).val(); }); }
                if (confirm(msg)) {
                    window.location.assign(url.replace("-ids-", val.substr(1)));
                }
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="TopContent" runat="server">
</asp:Content>
